furny.util
Class ImageUtils

java.lang.Object
  extended by furny.util.ImageUtils

public final class ImageUtils
extends java.lang.Object

Utility class for handling images.

Since:
11.08.2012
Author:
Stephan Dreyer

Nested Class Summary
static class ImageUtils.ImageType
          Image file formats.
 
Constructor Summary
private ImageUtils()
          Instantiation is not allowed.
 
Method Summary
static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img, int targetWidth, int targetHeight, java.lang.Object hint, boolean higherQuality)
          Convenience method that returns a scaled instance of the provided BufferedImage.
static java.awt.image.BufferedImage getScaledInstance(java.awt.Image img, int targetWidth, int targetHeight, java.lang.Object hint, boolean higherQuality)
          Convenience method that returns a scaled instance of the provided BufferedImage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtils

private ImageUtils()
Instantiation is not allowed.

Since:
11.08.2012
Method Detail

getScaledInstance

public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img,
                                                             int targetWidth,
                                                             int targetHeight,
                                                             java.lang.Object hint,
                                                             boolean higherQuality)
Convenience method that returns a scaled instance of the provided BufferedImage.

Parameters:
img - the original image to be scaled
targetWidth - the desired width of the scaled instance, in pixels
targetHeight - the desired height of the scaled instance, in pixels
hint - one of the rendering hints that corresponds to RenderingHints.KEY_INTERPOLATION (e.g. RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR, RenderingHints.VALUE_INTERPOLATION_BILINEAR, RenderingHints.VALUE_INTERPOLATION_BICUBIC)
higherQuality - if true, this method will use a multi-step scaling technique that provides higher quality than the usual one-step technique (only useful in downscaling cases, where targetWidth or targetHeight is smaller than the original dimensions, and generally only when the BILINEAR hint is specified)
Returns:
a scaled version of the original BufferedImage
Since:
11.08.2012

getScaledInstance

public static java.awt.image.BufferedImage getScaledInstance(java.awt.Image img,
                                                             int targetWidth,
                                                             int targetHeight,
                                                             java.lang.Object hint,
                                                             boolean higherQuality)
Convenience method that returns a scaled instance of the provided BufferedImage.

Parameters:
img - the original image to be scaled
targetWidth - the desired width of the scaled instance, in pixels
targetHeight - the desired height of the scaled instance, in pixels
hint - one of the rendering hints that corresponds to RenderingHints.KEY_INTERPOLATION (e.g. RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR, RenderingHints.VALUE_INTERPOLATION_BILINEAR, RenderingHints.VALUE_INTERPOLATION_BICUBIC)
higherQuality - if true, this method will use a multi-step scaling technique that provides higher quality than the usual one-step technique (only useful in downscaling cases, where targetWidth or targetHeight is smaller than the original dimensions, and generally only when the BILINEAR hint is specified)
Returns:
a scaled version of the original BufferedImage
Since:
11.08.2012